package com.wxapp.sale.service.controller;

import com.wxapp.common.constant.base.IBaseController;
import com.wxapp.common.constant.pojo.vm.ResultVm;
import com.wxapp.common.constant.pojo.vo.UserVo;
import com.wxapp.common.core.annotation.User;
import com.wxapp.sale.api.pojo.vm.goodsLabel.PGoodsLabelSelectVm;
import com.wxapp.sale.service.service.GoodsLabelService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author lgl
 * @Description 商品便签
 * @Datetime 2023/4/23 15:45
 * @Modified By
 */
@RestController
@RequestMapping("/goods/label")
@Tag(name = "商品便签")
@RequiredArgsConstructor
public class GoodsLabelController extends IBaseController {
    private final GoodsLabelService goodsLabelService;

    @GetMapping("save")
    @Operation(summary ="添加商品便签")
    public ResultVm<String> save(@Schema(hidden = true) @User UserVo userVo, @RequestParam String name) {
        return goodsLabelService.save(userVo, name);
    }

    @DeleteMapping("delete")
    @Operation(summary ="删除商品便签")
    public ResultVm<String> delete(@Schema(hidden = true) @User UserVo userVo, @RequestBody List<String> code) {
        return goodsLabelService.delete(userVo, code);
    }

    @GetMapping("select")
    @Operation(summary ="获取商品便签")
    public ResultVm<List<PGoodsLabelSelectVm>> select(@Schema(hidden = true) @User UserVo userVo) {
        return goodsLabelService.select(userVo);
    }
}
